package com.gxgeek.order.util;


import com.gxgeek.order.enums.CodeEnum;

/**
 * Created by gx on 2017/7/26.
 */
public class EnumUtil {

    public static <T extends CodeEnum> T getByCode(Integer code, Class<T>enumClass){

        for (T enums :enumClass.getEnumConstants()){
            if (enums.getCode() ==code){
                return enums;
            }
        }
        return null;

    }
}
